package com.TiaoJianJianZaiZiDong;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 作者: LCG
 * 日期: 2020/3/6 23:44
 * 描述:
 */
@Configuration
@EnableConfigurationProperties(TiaoJianProperties.class)
public class TiaoJianConfigure {

    @Autowired
    private TiaoJianProperties tiaoJianProperties;

    @Bean
    @ConditionalOnClass
    public TiaoJianService getTiaoJianService(TiaoJianProperties tiaoJianProperties){
        System.out.println("*****************==========加载TiaoJianService");
        return new TiaoJianService(tiaoJianProperties.isEnable());
    }



}
